<include file="Public/header"/>
<div class="row">
  <div class="wrapper wrapper-content animated">
    <div class="ibox-content">
      <div class="deal-bd order-bottom">订单管理</div>
        <form class="layui-form" action="" method="get" autocomplete="off" id="orderform">
          <input type="hidden" name="m" value="User">
          <input type="hidden" name="c" value="Order">
          <input type="hidden" name="a" value="channelorders">
          <div class="layui-form-item">
            <div class="layui-inline">
              <div class="layui-input-inline">
                <input type="text" name="orderid" autocomplete="off" placeholder="请输入订单号"
                       class="layui-input" value="<{$_GET['orderid']}>">
              </div>
              <div class="layui-input-inline">
                <input type="text" class="layui-input" name="createtime" id="createtime"
                       placeholder="提交时间段" value="<{$_GET['createtime']}>">
              </div>
              <div class="layui-input-inline">
                <input type="text" class="layui-input" name="successtime" id="successtime"
                       placeholder="成功时间段" value="<{$_GET['successtime']}>">
              </div>
            </div>
            <div class="layui-inline">
              <div class="layui-input-inline">
                <select name="cid">
                  <option value="">全部通道</option>
                  <if condition="channelaccount">
                    <volist name="channelaccount" id="vo">
                      <option <if condition="$_GET[cid] eq $vo[id]">selected</if>
                      value="<{$vo.id}>"><{$vo.title}></option>
                    </volist>
                  </if>
                </select>
              </div>

              <div class="layui-input-inline">
                <select name="status">
                  <option value="">全部状态</option>
                  <option value="1">成功，未返回</option>
                  <option value="2">成功，已返回</option>
                </select>
              </div>
              <div class="layui-input-inline">
                <select name="ddlx">
                  <option value="">订单类型</option>
                  <option <if condition="$_GET[ddlx] eq 2">selected</if> value="0">收款订单</option>
                  <option <if condition="$_GET[ddlx] eq 1">selected</if> value="1">充值订单</option>
                </select>
              </div>

            </div>

            <div class="layui-inline">
              <button type="submit" class="layui-btn layui-bg-blue"><span
                      class="glyphicon glyphicon-search"></span> 搜索
              </button>
              <a href="javascript:;" id="export" class="layui-btn layui-btn-danger layui-bg-green"><span class="glyphicon glyphicon-export"></span> 导出数据</a>
            </div>
          </div>
        </form>
      </div>
      <div class="container-fluid">
        <div class="row">
          <div class="col-xs-6 col-md-3 ">
            <div class="num-box">
              <div class="left-img"><img src="Public/Front/img/icon-1.png" alt=""></div>
              <div class="right-num">
                <p class="num-title">成功金额</p>
                <p class="main-num"><{$yuanshiamount}>元</p>
              </div>
            </div>
          </div>
          <div class="col-xs-6 col-md-3 ">
            <div class="num-box">
              <div class="left-img"><img src="Public/Front/img/icon-1.png" alt=""></div>
              <div class="right-num">
                <p class="num-title">入账金额</p>
                <p class="main-num"><{$stamount}>元</p>
              </div>
            </div>
          </div>
          <div class="col-xs-6 col-md-3 ">
            <div class="num-box">
              <div class="left-img"><img src="Public/Front/img/icon-1.png" alt=""></div>
              <div class="right-num">
                <p class="num-title">订单笔数</p>
                <p class="main-num"><{$ordercount}>笔</p>
              </div>
            </div>
          </div>
          <div class="col-xs-6 col-md-3 ">
            <div class="num-box">
              <div class="left-img"><img src="Public/Front/img/icon-1.png" alt=""></div>
              <div class="right-num">
                <p class="num-title">成功率</p>
                <p class="main-num"><{$success_rate}>%</p>
              </div>
            </div>
          </div>
        </div>
      </div>
        <!--交易列表-->
    <div class="tablediv" style="margin-top:20px">
      <table class="table table-hover choosetable">
        <thead>
        <tr>
          <th>记录ID</th>
          <th>类型</th>
          <th>订单号</th>
          <!--<th>商户号</th>-->
          <th>交易金额</th>
          <th>手续费</th>
          <th>实际金额</th>
          <th>提交时间</th>
          <th>成功时间</th>
          <th>通道</th>
          <!--<th>来源地址</th>-->
          <th>状态</th>
          <!--<th>操作</th>-->
        </tr>
        </thead>
        <tbody>
        <volist name="list" id="vo">
          <tr>
            <td><{$vo.id}></td>
            <td>
              <switch name="vo[ddlx]">
                <case value="1">充值</case>
                <default/>收款
              </switch>
            </td>
            <td style="text-align:center; color:#090;"><{$vo[out_trade_id]?$vo[out_trade_id]:$vo[pay_orderid]}>
              <if condition="$vo.del == 1">
                <span style="color: #f00;">×</span>
              </if>
            </td>
            <!--<td style="text-align:center;"><{$vo.pay_memberid}></td>-->
            <td style="text-align:center; color:#060"><{$vo.pay_amount}></td>
            <td style="text-align:center; color:#666"><?php echo $vo['pay_amount']*$vo['cost_rate']; ?></td>
            <td style="text-align:center; color:#C00"><?php echo $vo['pay_amount']-$vo['pay_amount']*$vo['cost_rate']; ?></td>
            <td style="text-align:center;"><{$vo.pay_applydate|date='Y-m-d H:i:s',###}></td>
            <td style="text-align:center;"><if condition="$vo[pay_successdate]"><{$vo.pay_successdate|date='Y-m-d H:i:s',###}><else/> --- </if></td>
            <td style="text-align:center;"><{$vo.pay_channel_account}></td>
            <!--<td style="text-align:center;"><a href="<{$vo.pay_tjurl}>" target="_blank" title="<{$vo.pay_tjurl}>">-->
              <!--来源地址</a></td>-->
            <td style="text-align:center; color:#369"><{$vo['pay_status']|status=###}></td>
            <!--<td>-->
              <!--<button class="layui-btn layui-btn-small" onclick="order_view('订单号:<{$vo.out_trade_id}>','<{:U('User/Order/show',['oid'=>$vo[id]])}>',600,400)">查看</button>-->
            <!--</td>-->
          </tr>
        </volist>
        </tbody>
      </table>
    </div>
        <!--交易列表-->
        <div class="page">
            <{$page}>
          </form>
        </div>
  </div>
</div>
<include file="Public/footer"/>
<script>
    layui.use(['laydate', 'laypage', 'layer', 'table', 'form'], function() {
        var laydate = layui.laydate //日期
            , laypage = layui.laypage //分页
            ,layer = layui.layer //弹层
            ,form = layui.form //表单
            , table = layui.table; //表格
        //日期时间范围
        laydate.render({
            elem: '#createtime'
            , type: 'datetime'
            ,theme: 'molv'
            , range: '|'
        });
        //日期时间范围
        laydate.render({
            elem: '#successtime'
            , type: 'datetime'
            ,theme: 'molv'
            , range: '|'
        });
    });
    /*订单-查看*/
    function order_view(title,url,w,h){
        x_admin_show(title,url,w,h);
    }
    /*订单-删除*/
    function order_del(obj, id) {
        layer.confirm('确认要删除吗？', function (index) {
            $.ajax({
                url:"<{:U('Order/delOrder')}>",
                type:'post',
                data:'id='+id,
                success:function(res){
                    if(res.status){
                        $(obj).parents("tr").remove();
                        layer.msg('已删除!',{icon:1,time:1000});
                    }
                }
            });
        });
    }
    $('#export').on('click',function(){
        var time = "<{$applyTTime}>"; //导出订单的时间段不能大于一个星期
        if (time <= 0){
            layer.alert('请选择"提交时间段"，点击搜索，再导出，只能导出一个星期内的订单');
            return;
        }
        if(time > 7*24*60*60) {
            layer.alert('请选择"提交时间段"，点击搜索，再导出，只能导出一个星期内的订单');
            return;
        }
        window.location.href
            = "<{:U('User/Order/exportorder').'?orderid='.$_GET[orderid].'&createtime='.$_GET[createtime].'&successtime='.$_GET[successtime].'&tongdao='.$_GET[tongdao].'&bank='.$_GET[bank].'&status='.$_GET[status].'&ddlx='.$_GET[ddlx]}>";
    });
    $('#pageList').change(function(){
        $('#pageForm').submit();
    });
</script>
</body>
</html>